  // 基于准备好的dom，初始化echarts实例
//var myChart = echarts.init(document.getElementById('main'));
  var myChart2 = echarts.init(document.getElementById('main2'));
  var myChart3 = echarts.init(document.getElementById('main3'));
  Load()
  var data={};
  $('.company_name').on('click',function(){
  	opsearch(path.company.index+'?op=search')
  })
  $('.driver_name').on('click',function(){
  	opsearch(path.driver.index+'?op=search')
  })
  {if $Think.get.driver_id}
  data.driver_id='{Think.get.driver_id}'
  {/if}
  {if $Think.get.company_id}
  data.company_id='{Think.get.company_id}'
  {/if}
  {if $Think.get.time}
  data['{$Think.get.time}']=1
  {/if}
  $('.reset').on('click',function(){
  	$(this).closest('form').find('input').each(function(){
  		$(this).val("")
  	})
  	$(this).closest('form').find('select').each(function(){
  		$(this).val("")
  	})
  })
  ajax(api.driver.stat,data,'post').done(function(res){
  	Load(1)
  	console.log(res)
  	var allmax=0;
  	for(var key2 in res.data){
  		if(allmax>res.data[key2]){
  			
  		}else{
  			allmax=res.data[key2]
  		}
  	}
  	$('span').each(function(){
  		if($(this).data('check')){
  			$(this).html(res.data[$(this).data('check')])
  		}
  	})

// myChart.setOption(option);
  	var option2 = {
    xAxis: {
        type: 'category',
        data: ['用户投诉', '取消数', '接单数', '评价数']
    },
    yAxis: {
        type: 'value'
    },
    series: [{
        data: [res.data.bad_evaluate, res.data.cancel, res.data.check, res.data.evaluate],
        type: 'bar'
    }]
};
	var option3 = {
    title : false,
    tooltip : {
        trigger: 'item',
        formatter: "{a} <br/>{b} : {c} ({d}%)"
    },
    legend: false,
    series : [
        {
            name: '访问来源',
            type: 'pie',
            radius : '55%',
            center: ['50%', '45%'],
            data:[
                {value:res.data.onlie, name:'在线司机'},
                {value:res.data.no_onlie, name:'不在线司机'}
            ],
            itemStyle: {
                emphasis: {
                    shadowBlur: 10,
                    shadowOffsetX: 0,
                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                }
            }
        }
    ]
};
    myChart2.setOption(option2);
    myChart3.setOption(option3);
  }).fail()
  
  
  
